package com.cmfi.dao.PlcDao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.cmfi.domain.PlcEntity.Plc;


// TODO 添加@Mapper
@Mapper
public interface PlcDao {

	@Select("select * from tbl_plc")
	public List<Plc> getAllPlc();
	
	@Select("select * from tbl_plc limit 1")
	public Plc getFirstPlc();
	
	@Select("select * from tbl_plc where plcNum=#{plcNum}")
	public Plc getPlcByPlcNum(String plcNum);
	
	@Insert("insert into tbl_plc(plcNum,plcName,connectAddress) values(#{plcNum},#{plcName},#{connectAddress})")
	public int savePlc(Plc plc);
	
	@Delete("delete from tbl_plc where plcNum = #{plcNum}")
    void deleteByPlcNum(Long plcNum);

}
